package com.frxuexi.mine.repository

import com.frxuexi.lib_base.BaseRepository
import com.frxuexi.lib_base.entity.BaseEntity
import com.frxuexi.lib_http.HttpType
import com.frxuexi.lib_http.NetWorkFactory
import com.frxuexi.mine.ApiService
import kotlinx.coroutines.flow.Flow
import okhttp3.RequestBody
import retrofit2.http.Body
import javax.inject.Inject

@OptIn
class UserRepository @Inject constructor():BaseRepository() {
    val apiService by lazy { NetWorkFactory.factory(HttpType.TOKEN).create(ApiService::class.java) }

    fun register(map: Map<String,Any>): Flow<BaseEntity<Any>>{
        return apiService.register(mapToBody(map))
    }
    fun login(map: Map<String,String>): Flow<BaseEntity<Any>>{
        return apiService.login(mapToBody(map))
    }
}